package balmysundaycandy.webtest.more.low.level.check.xmpp;

import balmysundaycandy.more.low.level.xmpp.XmppOperations;
import balmysundaycandy.test.AppengineEnvironmentTestCase;

import com.google.appengine.api.xmpp.XMPPServicePb.PresenceRequest;
import com.google.appengine.api.xmpp.XMPPServicePb.PresenceResponse;
import com.google.appengine.api.xmpp.XMPPServicePb.XmppInviteRequest;
import com.google.appengine.api.xmpp.XMPPServicePb.XmppInviteResponse;
import com.google.appengine.api.xmpp.XMPPServicePb.XmppMessageRequest;
import com.google.appengine.api.xmpp.XMPPServicePb.XmppMessageResponse;
import com.google.apphosting.api.ApiProxy;

public class XmppExecutableCheck extends AppengineEnvironmentTestCase {
	public void testGetPresence() {
		PresenceRequest request = new PresenceRequest();
		{
			request.setJid(ApiProxy.getCurrentEnvironment().getEmail());
			request.setFromJid(ApiProxy.getCurrentEnvironment().getEmail());
		}
		PresenceResponse response = XmppOperations.GET_PRESENCE.call(request);
		System.out.println(response);
	}

	public void testSendInvite() {
		XmppInviteRequest request = new XmppInviteRequest();
		{
			request.setJid(ApiProxy.getCurrentEnvironment().getEmail());
			request.setFromJid(ApiProxy.getCurrentEnvironment().getEmail());
		}
		XmppInviteResponse response = XmppOperations.SEND_INVITE.call(request);
		System.out.println(response);
	}

	public void testSendMessage() {
		XmppMessageRequest request = new XmppMessageRequest();
		{
			request.addJid(ApiProxy.getCurrentEnvironment().getEmail());
			request.setFromJid(ApiProxy.getCurrentEnvironment().getEmail());
			
			request.setBody("xmpp body");
			request.setType("test");
		}
		XmppMessageResponse response = XmppOperations.SEND_MESSAGE.call(request);
		System.out.println(response);
	}
}
